package com.yao.club.controller.goods;

import com.yao.club.entity.request.*;
import com.yao.club.entity.result.ResponseEntity;
import com.yao.club.entity.vo.*;
import com.yao.club.service.GoodsOrderService;
import com.yao.club.token.UserToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "俱乐部商城-订单管理")
@RestController
@RequestMapping("/mall/oder")
public class GoodsOrderController {

    @Autowired
    private GoodsOrderService goodsOrderService;


    @UserToken
    @ApiOperation(value = "运费计算")
    @PostMapping("/shippingTemplateInfo")
    public ResponseEntity<OrderShippingCostResultVO> shippingTemplateInfo(@RequestBody OrderShippingCostRequestEntity entity) {
        return goodsOrderService.shippingTemplateInfo(entity);
    }

    @UserToken
    @ApiOperation(value = "推荐优惠券")
    @PostMapping("/placeOrderCouponSelect")
    public ResponseEntity<OrderPlaceOrderCouponSelectResultVO> placeOrderCouponSelect(@RequestBody OrderCouponMaxDisRequest entity) {
        return goodsOrderService.placeOrderCouponSelect(entity);
    }

    @UserToken
    @ApiOperation(value = "加购好物")
    @PostMapping("/mallGoodsAdd")
    public ResponseEntity<OrderMallGoodsAddResultVO> mallGoodsAdd(@RequestBody OrderMallGoodsAddRequest entity) {
        return goodsOrderService.mallGoodsAdd(entity);
    }


    @UserToken
    @ApiOperation(value = "支付方式")
    @PostMapping("/orderCashDetail")
    public ResponseEntity<OrderCashDetailResultVO> orderCashDetail(@RequestBody OrderCashDetailRequest entity) {
        return goodsOrderService.orderCashDetail(entity);
    }



    @UserToken
    @ApiOperation(value = "手续费计算")
    @PostMapping("/payCostTrial")
    public ResponseEntity<OrderPayCostTrialResultVO> payCostTrial(@RequestBody OrderPayCostTrialRequest entity) {
        return goodsOrderService.payCostTrial(entity);
    }


    @UserToken
    @ApiOperation(value = "最大优惠")
    @PostMapping("/couponMaxDis")
    public ResponseEntity<OrderCouponMaxDisResultVO> couponMaxDis(@RequestBody OrderCouponMaxDisRequest entity) {
        return goodsOrderService.couponMaxDis(entity);
    }






}
